﻿@using Microsoft.Extensions.Localization
@using Volo.Abp.Users
@using Volo.Abp.MultiTenancy
@using global::Localization.Resources.AbpUi
@inherits AbpComponentBase
@inject ICurrentUser CurrentUser
@inject ICurrentTenant CurrentTenant
@inject IJSRuntime JsRuntime
@inject NavigationManager Navigation
@inject IStringLocalizer<AbpUiResource> UiLocalizer
<AuthorizeView>
    <Authorized>
        <Dropdown RightAligned="true">
            <DropdownToggle Color="Color.Default">
                @if (CurrentTenant.Name != null)
                {
                    <Text><i>@CurrentTenant.Name</i>\@CurrentUser.UserName</Text>
                }
                else
                {
                    <Text>@CurrentUser.UserName</Text>
                }
            </DropdownToggle>
            <DropdownMenu>
                @if (Menu != null)
                {
                    @foreach (var menuItem in Menu.Items)
                    {
                        <DropdownItem Clicked="@(() => NavigateToAsync(menuItem.Url, menuItem.Target))">@menuItem.DisplayName</DropdownItem>
                    }
                }
                <DropdownDivider />
                <DropdownItem Clicked="BeginSignOut">@UiLocalizer["Logout"]</DropdownItem>
            </DropdownMenu>
        </Dropdown>
    </Authorized>
    <NotAuthorized>
        <BarLink To="authentication/Login">@L["Login"]</BarLink>
    </NotAuthorized>
</AuthorizeView>

